package cn.edu.hit.action;

import com.opensymphony.xwork2.ActionSupport;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

public class LoginAction extends ActionSupport {
	/**
	 * 
	 */
	private HttpServletRequest request;
	private HttpSession session;
	private static final long serialVersionUID = 1L;
	private String username;
	private String password;
	
	public LoginAction(){
		request = ServletActionContext.getRequest();
		session = request.getSession();
		session.getServletContext();
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub  
		if(this.password.equals("124")&&this.username.equals("luojianping"))
			return SUCCESS;
		else 
			return ERROR;
	}
	public String login() throws Exception{
		if(this.password.equals("123")&&this.username.equals("qiuzhijie"))
			return SUCCESS;
		else 
			return ERROR;
	}
}
